Skip to content

Conversation

@deandreamatias
Copy link
Contributor

💡 Motivation and Context

To avoid a info lint about deprecation.
Related PR on Flutter.
This would improve the pub points on pub.dev

💚 How did you test it?

When applied the change, the lint was solved

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

@deandreamatias deandreamatias requested a review from a team as a code owner February 10, 2026 17:20
Comment on lines +116 to +118
final r = color.r;
final g = color.g;
final b = color.b;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to confirm

flutter: '>=3.22.0'

color.r | g | b exist alreaduy in flutter 3.22 right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I tested it with version 3.22.0 (FVM) and works fine.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecation message says https://api.flutter.dev/flutter/dart-ui/Color/green.html

Use (*.g * 255.0).round().clamp(0, 255)

Which to me seems that Color.g is in a different range (0-1) than Color.green (0 - 255)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah at least the deprecated message says to do the calculation/round and clamp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could update this to be the exact color that had before but with new API

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah has to be the same color otherwise this function will not function properly

Copy link
Member

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants